package ro.sergiu.widecomponents.table.beanmodel;

import java.lang.reflect.Field;
import org.apache.commons.lang3.StringUtils;

public class DefaultBeanTableModelAdapter extends BeanTableAdapter {

    public DefaultBeanTableModelAdapter(Class<?> cls) {
        super(cls);
    }

    @Override
    public int getWidth(Field field) {
        return -100;
    }

    @Override
    public String getColumnTitle(Field field) {
        return StringUtils.capitalize(field.getName().replaceAll("(\\p{Ll})(\\p{Lu})", "$1 $2"));
    }

    @Override
    public Class<?> getColumnType(Field field) {
        return field.getType();
    }

    @Override
    public boolean isColumnEditable(Field field) {
        return true;
    }

    @Override
    public boolean isValidField(Field field) {
        return true;
    }
}
